package org.admanager.piadladmapping.plugin.diagram.navigator;

import org.admanager.piadladmanagement.plugin.piadladmanagement.PComponentPort;
import org.admanager.piadladmanagement.plugin.piadladmanagement.PConnectorRole;
import org.admanager.piadladmanagement.plugin.piadladmanagement.PMultiplicity;
import org.admanager.piadladmanagement.plugin.piadladmanagement.Port;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.Architecture2EditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ArchitectureEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ArchitectureName2EditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ArchitectureNameEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.CBAPatternEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.CBAPatternNameEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ComponentEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ComponentMappingEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ComponentMappingSourceEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ComponentMappingTargetEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ComponentNameEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ComponentPortMappingEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ComponentPortMappingSourceEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ComponentPortMappingTargetEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ConnectorEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ConnectorMappingEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ConnectorMappingSourceEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ConnectorMappingTargetEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ConnectorNameEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ConnectorRoleMappingEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ConnectorRoleMappingSourceEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.ConnectorRoleMappingTargetEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.MappingRootEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PComponent2EditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PComponentEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PComponentName2EditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PComponentNameEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PComponentPort2EditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PComponentPortEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PConnector2EditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PConnectorEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PConnectorName2EditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PConnectorNameEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PConnectorRole2EditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PConnectorRoleEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PConstraintEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PConstraintNameEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PMultiplicityEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PRoleEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PRoleNameEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.Port2EditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.PortEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.RelayEditPart;
import org.admanager.piadladmapping.plugin.diagram.edit.parts.UnificationEditPart;
import org.admanager.piadladmapping.plugin.diagram.part.PiADLADManagementMetamodelDiagramEditorPlugin;
import org.admanager.piadladmapping.plugin.diagram.part.PiADLADManagementMetamodelVisualIDRegistry;
import org.admanager.piadladmapping.plugin.diagram.providers.PiADLADManagementMetamodelElementTypes;
import org.admanager.piadladmapping.plugin.diagram.providers.PiADLADManagementMetamodelParserProvider;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.viewers.ITreePathLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.ViewerLabel;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
import org.eclipse.ui.navigator.ICommonLabelProvider;

/**
 * @generated
 */
public class PiADLADManagementMetamodelNavigatorLabelProvider extends
		LabelProvider implements ICommonLabelProvider, ITreePathLabelProvider {

	/**
	 * @generated
	 */
	static {
		PiADLADManagementMetamodelDiagramEditorPlugin
				.getInstance()
				.getImageRegistry()
				.put("Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
		PiADLADManagementMetamodelDiagramEditorPlugin
				.getInstance()
				.getImageRegistry()
				.put("Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	public void updateLabel(ViewerLabel label, TreePath elementPath) {
		Object element = elementPath.getLastSegment();
		if (element instanceof PiADLADManagementMetamodelNavigatorItem
				&& !isOwnView(((PiADLADManagementMetamodelNavigatorItem) element)
						.getView())) {
			return;
		}
		label.setText(getText(element));
		label.setImage(getImage(element));
	}

	/**
	 * @generated
	 */
	public Image getImage(Object element) {
		if (element instanceof PiADLADManagementMetamodelNavigatorGroup) {
			PiADLADManagementMetamodelNavigatorGroup group = (PiADLADManagementMetamodelNavigatorGroup) element;
			return PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.getBundledImage(group.getIcon());
		}

		if (element instanceof PiADLADManagementMetamodelNavigatorItem) {
			PiADLADManagementMetamodelNavigatorItem navigatorItem = (PiADLADManagementMetamodelNavigatorItem) element;
			if (!isOwnView(navigatorItem.getView())) {
				return super.getImage(element);
			}
			return getImage(navigatorItem.getView());
		}

		// Due to plugin.xml content will be called only for "own" views
		if (element instanceof IAdaptable) {
			View view = (View) ((IAdaptable) element).getAdapter(View.class);
			if (view != null && isOwnView(view)) {
				return getImage(view);
			}
		}

		return super.getImage(element);
	}

	/**
	 * @generated
	 */
	public Image getImage(View view) {
		switch (PiADLADManagementMetamodelVisualIDRegistry.getVisualID(view)) {
		case ConnectorRoleMappingTargetEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://piadladmanagement/1.0?ConnectorRoleMapping?target", PiADLADManagementMetamodelElementTypes.ConnectorRoleMappingTarget_4050); //$NON-NLS-1$
		case ConnectorMappingSourceEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://piadladmanagement/1.0?ConnectorMapping?source", PiADLADManagementMetamodelElementTypes.ConnectorMappingSource_4044); //$NON-NLS-1$
		case PComponentPort2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?PComponentPort", PiADLADManagementMetamodelElementTypes.PComponentPort_3044); //$NON-NLS-1$
		case Port2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?Port", PiADLADManagementMetamodelElementTypes.Port_3052); //$NON-NLS-1$
		case ConnectorMappingEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://piadladmanagement/1.0?ConnectorMapping", PiADLADManagementMetamodelElementTypes.ConnectorMapping_2032); //$NON-NLS-1$
		case MappingRootEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Diagram?http://piadladmanagement/1.0?MappingRoot", PiADLADManagementMetamodelElementTypes.MappingRoot_1000); //$NON-NLS-1$
		case ArchitectureEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://piadladmanagement/1.0?Architecture", PiADLADManagementMetamodelElementTypes.Architecture_2035); //$NON-NLS-1$
		case ComponentMappingSourceEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://piadladmanagement/1.0?ComponentMapping?source", PiADLADManagementMetamodelElementTypes.ComponentMappingSource_4046); //$NON-NLS-1$
		case PConnectorEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?PConnector", PiADLADManagementMetamodelElementTypes.PConnector_3045); //$NON-NLS-1$
		case PMultiplicityEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?PMultiplicity", PiADLADManagementMetamodelElementTypes.PMultiplicity_3037); //$NON-NLS-1$
		case ConnectorRoleMappingEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://piadladmanagement/1.0?ConnectorRoleMapping", PiADLADManagementMetamodelElementTypes.ConnectorRoleMapping_2031); //$NON-NLS-1$
		case PComponent2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?PComponent", PiADLADManagementMetamodelElementTypes.PComponent_3043); //$NON-NLS-1$
		case PConnectorRoleEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?PConnectorRole", PiADLADManagementMetamodelElementTypes.PConnectorRole_3041); //$NON-NLS-1$
		case ConnectorEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?Connector", PiADLADManagementMetamodelElementTypes.Connector_3051); //$NON-NLS-1$
		case PComponentPortEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?PComponentPort", PiADLADManagementMetamodelElementTypes.PComponentPort_3040); //$NON-NLS-1$
		case PConnector2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?PConnector", PiADLADManagementMetamodelElementTypes.PConnector_3047); //$NON-NLS-1$
		case PConnectorRole2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?PConnectorRole", PiADLADManagementMetamodelElementTypes.PConnectorRole_3046); //$NON-NLS-1$
		case CBAPatternEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://piadladmanagement/1.0?CBAPattern", PiADLADManagementMetamodelElementTypes.CBAPattern_2034); //$NON-NLS-1$
		case ComponentPortMappingSourceEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://piadladmanagement/1.0?ComponentPortMapping?source", PiADLADManagementMetamodelElementTypes.ComponentPortMappingSource_4047); //$NON-NLS-1$
		case ComponentPortMappingTargetEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://piadladmanagement/1.0?ComponentPortMapping?target", PiADLADManagementMetamodelElementTypes.ComponentPortMappingTarget_4049); //$NON-NLS-1$
		case PRoleEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?PRole", PiADLADManagementMetamodelElementTypes.PRole_3038); //$NON-NLS-1$
		case Architecture2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?Architecture", PiADLADManagementMetamodelElementTypes.Architecture_3050); //$NON-NLS-1$
		case PortEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?Port", PiADLADManagementMetamodelElementTypes.Port_3049); //$NON-NLS-1$
		case ConnectorMappingTargetEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://piadladmanagement/1.0?ConnectorMapping?target", PiADLADManagementMetamodelElementTypes.ConnectorMappingTarget_4043); //$NON-NLS-1$
		case ComponentMappingTargetEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://piadladmanagement/1.0?ComponentMapping?target", PiADLADManagementMetamodelElementTypes.ComponentMappingTarget_4048); //$NON-NLS-1$
		case PConstraintEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?PConstraint", PiADLADManagementMetamodelElementTypes.PConstraint_3039); //$NON-NLS-1$
		case ComponentEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?Component", PiADLADManagementMetamodelElementTypes.Component_3048); //$NON-NLS-1$
		case PComponentEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://piadladmanagement/1.0?PComponent", PiADLADManagementMetamodelElementTypes.PComponent_3042); //$NON-NLS-1$
		case ConnectorRoleMappingSourceEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://piadladmanagement/1.0?ConnectorRoleMapping?source", PiADLADManagementMetamodelElementTypes.ConnectorRoleMappingSource_4045); //$NON-NLS-1$
		case ComponentMappingEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://piadladmanagement/1.0?ComponentMapping", PiADLADManagementMetamodelElementTypes.ComponentMapping_2033); //$NON-NLS-1$
		case RelayEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://piadladmanagement/1.0?Relay", PiADLADManagementMetamodelElementTypes.Relay_4052); //$NON-NLS-1$
		case UnificationEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://piadladmanagement/1.0?Unification", PiADLADManagementMetamodelElementTypes.Unification_4051); //$NON-NLS-1$
		case ComponentPortMappingEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://piadladmanagement/1.0?ComponentPortMapping", PiADLADManagementMetamodelElementTypes.ComponentPortMapping_2030); //$NON-NLS-1$
		}
		return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private Image getImage(String key, IElementType elementType) {
		ImageRegistry imageRegistry = PiADLADManagementMetamodelDiagramEditorPlugin
				.getInstance().getImageRegistry();
		Image image = imageRegistry.get(key);
		if (image == null
				&& elementType != null
				&& PiADLADManagementMetamodelElementTypes
						.isKnownElementType(elementType)) {
			image = PiADLADManagementMetamodelElementTypes
					.getImage(elementType);
			imageRegistry.put(key, image);
		}

		if (image == null) {
			image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
			imageRegistry.put(key, image);
		}
		return image;
	}

	/**
	 * @generated
	 */
	public String getText(Object element) {
		if (element instanceof PiADLADManagementMetamodelNavigatorGroup) {
			PiADLADManagementMetamodelNavigatorGroup group = (PiADLADManagementMetamodelNavigatorGroup) element;
			return group.getGroupName();
		}

		if (element instanceof PiADLADManagementMetamodelNavigatorItem) {
			PiADLADManagementMetamodelNavigatorItem navigatorItem = (PiADLADManagementMetamodelNavigatorItem) element;
			if (!isOwnView(navigatorItem.getView())) {
				return null;
			}
			return getText(navigatorItem.getView());
		}

		// Due to plugin.xml content will be called only for "own" views
		if (element instanceof IAdaptable) {
			View view = (View) ((IAdaptable) element).getAdapter(View.class);
			if (view != null && isOwnView(view)) {
				return getText(view);
			}
		}

		return super.getText(element);
	}

	/**
	 * @generated
	 */
	public String getText(View view) {
		if (view.getElement() != null && view.getElement().eIsProxy()) {
			return getUnresolvedDomainElementProxyText(view);
		}
		switch (PiADLADManagementMetamodelVisualIDRegistry.getVisualID(view)) {
		case ConnectorRoleMappingTargetEditPart.VISUAL_ID:
			return getConnectorRoleMappingTarget_4050Text(view);
		case ConnectorMappingSourceEditPart.VISUAL_ID:
			return getConnectorMappingSource_4044Text(view);
		case PComponentPort2EditPart.VISUAL_ID:
			return getPComponentPort_3044Text(view);
		case Port2EditPart.VISUAL_ID:
			return getPort_3052Text(view);
		case ConnectorMappingEditPart.VISUAL_ID:
			return getConnectorMapping_2032Text(view);
		case MappingRootEditPart.VISUAL_ID:
			return getMappingRoot_1000Text(view);
		case ArchitectureEditPart.VISUAL_ID:
			return getArchitecture_2035Text(view);
		case ComponentMappingSourceEditPart.VISUAL_ID:
			return getComponentMappingSource_4046Text(view);
		case PConnectorEditPart.VISUAL_ID:
			return getPConnector_3045Text(view);
		case PMultiplicityEditPart.VISUAL_ID:
			return getPMultiplicity_3037Text(view);
		case ConnectorRoleMappingEditPart.VISUAL_ID:
			return getConnectorRoleMapping_2031Text(view);
		case PComponent2EditPart.VISUAL_ID:
			return getPComponent_3043Text(view);
		case PConnectorRoleEditPart.VISUAL_ID:
			return getPConnectorRole_3041Text(view);
		case ConnectorEditPart.VISUAL_ID:
			return getConnector_3051Text(view);
		case PComponentPortEditPart.VISUAL_ID:
			return getPComponentPort_3040Text(view);
		case PConnector2EditPart.VISUAL_ID:
			return getPConnector_3047Text(view);
		case PConnectorRole2EditPart.VISUAL_ID:
			return getPConnectorRole_3046Text(view);
		case CBAPatternEditPart.VISUAL_ID:
			return getCBAPattern_2034Text(view);
		case ComponentPortMappingSourceEditPart.VISUAL_ID:
			return getComponentPortMappingSource_4047Text(view);
		case ComponentPortMappingTargetEditPart.VISUAL_ID:
			return getComponentPortMappingTarget_4049Text(view);
		case PRoleEditPart.VISUAL_ID:
			return getPRole_3038Text(view);
		case Architecture2EditPart.VISUAL_ID:
			return getArchitecture_3050Text(view);
		case PortEditPart.VISUAL_ID:
			return getPort_3049Text(view);
		case ConnectorMappingTargetEditPart.VISUAL_ID:
			return getConnectorMappingTarget_4043Text(view);
		case ComponentMappingTargetEditPart.VISUAL_ID:
			return getComponentMappingTarget_4048Text(view);
		case PConstraintEditPart.VISUAL_ID:
			return getPConstraint_3039Text(view);
		case ComponentEditPart.VISUAL_ID:
			return getComponent_3048Text(view);
		case PComponentEditPart.VISUAL_ID:
			return getPComponent_3042Text(view);
		case ConnectorRoleMappingSourceEditPart.VISUAL_ID:
			return getConnectorRoleMappingSource_4045Text(view);
		case ComponentMappingEditPart.VISUAL_ID:
			return getComponentMapping_2033Text(view);
		case RelayEditPart.VISUAL_ID:
			return getRelay_4052Text(view);
		case UnificationEditPart.VISUAL_ID:
			return getUnification_4051Text(view);
		case ComponentPortMappingEditPart.VISUAL_ID:
			return getComponentPortMapping_2030Text(view);
		}
		return getUnknownElementText(view);
	}

	/**
	 * @generated
	 */
	private String getConnectorRoleMappingTarget_4050Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getConnectorMappingSource_4044Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getPComponentPort_3044Text(View view) {
		PComponentPort domainModelElement = (PComponentPort) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin
					.getInstance()
					.logError(
							"No domain element for view with visualID = " + 3044); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPort_3052Text(View view) {
		Port domainModelElement = (Port) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin
					.getInstance()
					.logError(
							"No domain element for view with visualID = " + 3052); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getConnectorMapping_2032Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getMappingRoot_1000Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getArchitecture_2035Text(View view) {
		IParser parser = PiADLADManagementMetamodelParserProvider.getParser(
				PiADLADManagementMetamodelElementTypes.Architecture_2035, view
						.getElement() != null ? view.getElement() : view,
				PiADLADManagementMetamodelVisualIDRegistry
						.getType(ArchitectureNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.logError("Parser was not found for label " + 5035); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getComponentMappingSource_4046Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getPConnector_3045Text(View view) {
		IParser parser = PiADLADManagementMetamodelParserProvider.getParser(
				PiADLADManagementMetamodelElementTypes.PConnector_3045, view
						.getElement() != null ? view.getElement() : view,
				PiADLADManagementMetamodelVisualIDRegistry
						.getType(PConnectorNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.logError("Parser was not found for label " + 5027); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPMultiplicity_3037Text(View view) {
		PMultiplicity domainModelElement = (PMultiplicity) view.getElement();
		if (domainModelElement != null) {
			return String.valueOf(domainModelElement.getLowerBound());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin
					.getInstance()
					.logError(
							"No domain element for view with visualID = " + 3037); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getConnectorRoleMapping_2031Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getPComponent_3043Text(View view) {
		IParser parser = PiADLADManagementMetamodelParserProvider.getParser(
				PiADLADManagementMetamodelElementTypes.PComponent_3043, view
						.getElement() != null ? view.getElement() : view,
				PiADLADManagementMetamodelVisualIDRegistry
						.getType(PComponentName2EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.logError("Parser was not found for label " + 5028); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPConnectorRole_3041Text(View view) {
		PConnectorRole domainModelElement = (PConnectorRole) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin
					.getInstance()
					.logError(
							"No domain element for view with visualID = " + 3041); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getConnector_3051Text(View view) {
		IParser parser = PiADLADManagementMetamodelParserProvider.getParser(
				PiADLADManagementMetamodelElementTypes.Connector_3051, view
						.getElement() != null ? view.getElement() : view,
				PiADLADManagementMetamodelVisualIDRegistry
						.getType(ConnectorNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.logError("Parser was not found for label " + 5032); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPComponentPort_3040Text(View view) {
		PComponentPort domainModelElement = (PComponentPort) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin
					.getInstance()
					.logError(
							"No domain element for view with visualID = " + 3040); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPConnector_3047Text(View view) {
		IParser parser = PiADLADManagementMetamodelParserProvider.getParser(
				PiADLADManagementMetamodelElementTypes.PConnector_3047, view
						.getElement() != null ? view.getElement() : view,
				PiADLADManagementMetamodelVisualIDRegistry
						.getType(PConnectorName2EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.logError("Parser was not found for label " + 5030); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPConnectorRole_3046Text(View view) {
		PConnectorRole domainModelElement = (PConnectorRole) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin
					.getInstance()
					.logError(
							"No domain element for view with visualID = " + 3046); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getCBAPattern_2034Text(View view) {
		IParser parser = PiADLADManagementMetamodelParserProvider.getParser(
				PiADLADManagementMetamodelElementTypes.CBAPattern_2034, view
						.getElement() != null ? view.getElement() : view,
				PiADLADManagementMetamodelVisualIDRegistry
						.getType(CBAPatternNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.logError("Parser was not found for label " + 5031); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getComponentPortMappingSource_4047Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getComponentPortMappingTarget_4049Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getPRole_3038Text(View view) {
		IParser parser = PiADLADManagementMetamodelParserProvider.getParser(
				PiADLADManagementMetamodelElementTypes.PRole_3038, view
						.getElement() != null ? view.getElement() : view,
				PiADLADManagementMetamodelVisualIDRegistry
						.getType(PRoleNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.logError("Parser was not found for label " + 5026); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getArchitecture_3050Text(View view) {
		IParser parser = PiADLADManagementMetamodelParserProvider.getParser(
				PiADLADManagementMetamodelElementTypes.Architecture_3050, view
						.getElement() != null ? view.getElement() : view,
				PiADLADManagementMetamodelVisualIDRegistry
						.getType(ArchitectureName2EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.logError("Parser was not found for label " + 5033); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPort_3049Text(View view) {
		Port domainModelElement = (Port) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin
					.getInstance()
					.logError(
							"No domain element for view with visualID = " + 3049); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getConnectorMappingTarget_4043Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getComponentMappingTarget_4048Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getPConstraint_3039Text(View view) {
		IParser parser = PiADLADManagementMetamodelParserProvider.getParser(
				PiADLADManagementMetamodelElementTypes.PConstraint_3039, view
						.getElement() != null ? view.getElement() : view,
				PiADLADManagementMetamodelVisualIDRegistry
						.getType(PConstraintNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.logError("Parser was not found for label " + 5025); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getComponent_3048Text(View view) {
		IParser parser = PiADLADManagementMetamodelParserProvider.getParser(
				PiADLADManagementMetamodelElementTypes.Component_3048, view
						.getElement() != null ? view.getElement() : view,
				PiADLADManagementMetamodelVisualIDRegistry
						.getType(ComponentNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.logError("Parser was not found for label " + 5034); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPComponent_3042Text(View view) {
		IParser parser = PiADLADManagementMetamodelParserProvider.getParser(
				PiADLADManagementMetamodelElementTypes.PComponent_3042, view
						.getElement() != null ? view.getElement() : view,
				PiADLADManagementMetamodelVisualIDRegistry
						.getType(PComponentNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			PiADLADManagementMetamodelDiagramEditorPlugin.getInstance()
					.logError("Parser was not found for label " + 5029); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getConnectorRoleMappingSource_4045Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getComponentMapping_2033Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getRelay_4052Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getUnification_4051Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getComponentPortMapping_2030Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getUnknownElementText(View view) {
		return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
	}

	/**
	 * @generated
	 */
	private String getUnresolvedDomainElementProxyText(View view) {
		return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
	}

	/**
	 * @generated
	 */
	public void init(ICommonContentExtensionSite aConfig) {
	}

	/**
	 * @generated
	 */
	public void restoreState(IMemento aMemento) {
	}

	/**
	 * @generated
	 */
	public void saveState(IMemento aMemento) {
	}

	/**
	 * @generated
	 */
	public String getDescription(Object anElement) {
		return null;
	}

	/**
	 * @generated
	 */
	private boolean isOwnView(View view) {
		return MappingRootEditPart.MODEL_ID
				.equals(PiADLADManagementMetamodelVisualIDRegistry
						.getModelID(view));
	}

}
